<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>Untitled Document</title>
    </head>
    <body>
        <% if @acc.nil? %>
        <h1>The selected room has no Accomodation</h1>
        <% else %>
        <p>
            <b>Room:</b>
            <%=h @acc.room_id %>
        </p>
        <p>
            <b>Guest:</b>
            <%=h @acc.guest_id %>
        </p>
        <p>
            <b>Arrive date:</b>
            <%=h @acc.arrive_date %>
        </p>
        <p>
            <b>Exit date:</b>
            <%=h @acc.exit_date %>
        </p>
        <p>
            <b>Checked Out:</b>
            <%=h @acc.checkedOut %>
        </p>
        <table>
        <tr>
            <th>
                Id
            </th>
            <th>
                Service
            </th>
            <th>
                Price
            </th>           
        </tr>
        <% @requests.each do |request| %>
		<tr>
        <td>
            <%= @count %>
            <% @count = @count + 1 %>
        </td>
        <td>
            <% @service = Service.find_by_id(request.service_id) %>
            <%=h @service.myName %>
        </td>
        <td>
            $<%=h @service.price %>
			<% @services_cost = @services_cost + @service.price %>
        </td>
		<td>
			<%= link_to 'Cancel service', request, :confirm => 'Are you sure?', :method => :delete %></td>
		</td>
		</tr>
        <%end %>
		</table>
		<br>
        <table>
            <tr>
                <td>
                    Expenses: 
                </td>
            </tr>
            <tr>
                <td>
                    Services: $<%= @services_cost %>
                </td>
            </tr>
			<tr>
				<td>
            		Room description: <%= @roomdesc.name %>
				</td>
           	</tr>
            <tr>            	
                <td>
                    Daily price: $<%= @daily_price %>
                </td>
			</tr>
			<tr>
				<td>
				Number of days: <%= @num_days %>
				</td>
			</tr>
			<tr>
				<td>
				Total without services: $<%= (@num_days*@daily_price) %>
				</td>
			</tr>
			<tr>
				<td>
				Total expenses: $<%= (@num_days*@daily_price)+@services_cost.to_f %>
				</td>
			</tr>
		  </table>
		  <%= button_to 'Checkout', :action=>'checkout'%>	
		<% end %>		
					      
		<br>
		<br>  
        <%= link_to 'Back', accomodations_path %>        
    </body>
</html>
